/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package duplicatefilemanager;

import java.awt.Desktop;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.swing.*;
import javax.swing.filechooser.FileNameExtensionFilter;
import javax.swing.GroupLayout.Alignment;
import javax.swing.LayoutStyle.ComponentPlacement;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.nio.file.Files;

/**
 *
 * @author Pastor Albano Jr
 */
public class MainFrame extends javax.swing.JFrame {
    
    private DefaultListModel listModel1;
    private DefaultListModel listModel2;
    
    /**
     * Creates new form MainFrame
     */
    public MainFrame() {
        initComponents();
        setTitle("Duplicate File Manager");
        setLocationRelativeTo(null);
        jFileChooser1 = new JFileChooser();
        jFileChooser1.setCurrentDirectory(new java.io.File("."));
        jFileChooser1.setDialogTitle("Select Directory");
        jFileChooser1.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        jFileChooser1.setAcceptAllFileFilterUsed(false);
        jFileChooser1.setMultiSelectionEnabled(true);
        listModel1 = new DefaultListModel();
        listModel2 = new DefaultListModel();
        directoriesToScan.setModel(listModel1);
        listOfDupliacateFiles.setModel(listModel2);
        
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jFileChooser1 = new javax.swing.JFileChooser();
        jComboBox1 = new javax.swing.JComboBox();
        jLabel1 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        directoriesToScan = new javax.swing.JList();
        jScrollPane2 = new javax.swing.JScrollPane();
        listOfDupliacateFiles = new javax.swing.JList();
        addButton = new javax.swing.JButton();
        scanButton = new javax.swing.JButton();
        removeButton = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        clearButton = new javax.swing.JButton();
        jPanel1 = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        totalFiles = new javax.swing.JLabel();
        duplicateFiles = new javax.swing.JLabel();
        exportButton = new javax.swing.JButton();
        removeAllButton = new javax.swing.JButton();
        deleteButton = new javax.swing.JButton();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        addFolderMenu = new javax.swing.JMenuItem();
        resetMenu = new javax.swing.JMenuItem();
        exitMenu = new javax.swing.JMenuItem();
        instructions = new javax.swing.JMenu();
        instuctions = new javax.swing.JMenuItem();
        aboutMenu = new javax.swing.JMenuItem();

        jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setResizable(false);

        jLabel1.setFont(new java.awt.Font("Verdana", 1, 12)); // NOI18N
        jLabel1.setText("Directories to Scan:");

        directoriesToScan.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        directoriesToScan.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                directoriesToScanValueChanged(evt);
            }
        });
        jScrollPane1.setViewportView(directoriesToScan);

        listOfDupliacateFiles.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jScrollPane2.setViewportView(listOfDupliacateFiles);

        addButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/plus.gif"))); // NOI18N
        addButton.setText(" Add");
        addButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addButtonActionPerformed(evt);
            }
        });
        addButton.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                showDirectories(evt);
            }
        });

        scanButton.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        scanButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/scan.png"))); // NOI18N
        scanButton.setText("Scan");
        scanButton.setEnabled(false);
        scanButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                scanButtonActionPerformed(evt);
            }
        });

        removeButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/minus.gif"))); // NOI18N
        removeButton.setText(" Remove");
        removeButton.setEnabled(false);
        removeButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                removeButtonActionPerformed(evt);
            }
        });

        jLabel2.setFont(new java.awt.Font("Verdana", 1, 12)); // NOI18N
        jLabel2.setText("Duplicate File List:");

        clearButton.setText("Clear");
        clearButton.setEnabled(false);
        clearButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                clearButtonActionPerformed(evt);
            }
        });

        jPanel1.setBackground(new java.awt.Color(255, 255, 255));
        jPanel1.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 102, 204), 1, true));

        jLabel5.setFont(new java.awt.Font("Aharoni", 0, 11)); // NOI18N
        jLabel5.setText("Duplicate Files:");

        jLabel3.setFont(new java.awt.Font("Aharoni", 0, 11)); // NOI18N
        jLabel3.setText("Total Files:");

        totalFiles.setText("0");

        duplicateFiles.setText("0");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(8, 8, 8)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(totalFiles, javax.swing.GroupLayout.DEFAULT_SIZE, 38, Short.MAX_VALUE)
                    .addComponent(duplicateFiles, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(6, 6, 6)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(totalFiles))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(duplicateFiles))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        exportButton.setText("Export");
        exportButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                exportButtonActionPerformed(evt);
            }
        });

        removeAllButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/minus.gif"))); // NOI18N
        removeAllButton.setText(" Remove All");
        removeAllButton.setEnabled(false);
        removeAllButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                removeAllButtonActionPerformed(evt);
            }
        });

        deleteButton.setText("Delete");
        deleteButton.setEnabled(false);
        deleteButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                deleteButtonActionPerformed(evt);
            }
        });

        jMenu1.setText("File");

        addFolderMenu.setText("Add Folder...");
        addFolderMenu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addFolderMenuActionPerformed(evt);
            }
        });
        jMenu1.add(addFolderMenu);

        resetMenu.setText("Reset");
        resetMenu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                resetMenuActionPerformed(evt);
            }
        });
        jMenu1.add(resetMenu);

        exitMenu.setText("Exit");
        exitMenu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                exitMenuActionPerformed(evt);
            }
        });
        jMenu1.add(exitMenu);

        jMenuBar1.add(jMenu1);

        instructions.setText("Help");

        instuctions.setText("Instructions");
        instuctions.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                instuctionsActionPerformed(evt);
            }
        });
        instructions.add(instuctions);

        aboutMenu.setText("About Duplicate Calculator");
        aboutMenu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                aboutMenuActionPerformed(evt);
            }
        });
        instructions.add(aboutMenu);

        jMenuBar1.add(instructions);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGap(440, 440, 440))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(exportButton, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(deleteButton)
                                .addGap(18, 18, 18)
                                .addComponent(clearButton, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addGap(12, 12, 12)
                                .addComponent(addButton, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(removeAllButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(removeButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addGap(15, 15, 15)
                                .addComponent(scanButton, javax.swing.GroupLayout.PREFERRED_SIZE, 154, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addContainerGap())
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(removeButton)
                            .addComponent(addButton))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(removeAllButton))
                    .addComponent(scanButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(18, 18, 18)
                .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 221, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(clearButton, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(exportButton)
                    .addComponent(deleteButton))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void showDirectories(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_showDirectories

    }//GEN-LAST:event_showDirectories

    private void addButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addButtonActionPerformed
        if (jFileChooser1.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
            for (int x = 0; x < jFileChooser1.getSelectedFiles().length; x++) {
                listModel1.addElement(jFileChooser1.getSelectedFiles()[x].toString());
            }
            scanButton.setEnabled(true);
            removeAllButton.setEnabled(true);
        }
    }//GEN-LAST:event_addButtonActionPerformed

    private void directoriesToScanValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_directoriesToScanValueChanged
        if (!listModel1.isEmpty()) {
            removeButton.setEnabled(true);
        }
    }//GEN-LAST:event_directoriesToScanValueChanged

    private void removeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeButtonActionPerformed
        int size = directoriesToScan.getSelectedIndices().length;
        for (int x = 0; x < size; x++) {
            if (directoriesToScan.getSelectedIndex() != -1) {
              listModel1.remove(directoriesToScan.getSelectedIndex());
            }
        }
        if (listModel1.isEmpty()) {
            removeButton.setEnabled(false);
            scanButton.setEnabled(false);
        }  
    }//GEN-LAST:event_removeButtonActionPerformed

    private void aboutMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_aboutMenuActionPerformed
        JOptionPane.showMessageDialog(null, "Duplicate File Manager v1.0"
                + "\n Group 4 Programming Applications Project"
                + "\n Leader: "
                + "\n ALBANO, PASTOR JR. B."
                + "\n Members:"
                + "\n SIMON, ARMEL JEROME"
                + "\n UYAAN, JOMAR"
                + "\n SANTOS, CHERRY MAE"
                + "\n MACAM, DENMARK");
    }//GEN-LAST:event_aboutMenuActionPerformed

    private void scanButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_scanButtonActionPerformed
        if (!listModel1.isEmpty()) {
            if (!listModel2.isEmpty()) {
                listModel2.clear();  
            }
            duplicateFiles.setText("0");
            totalFiles.setText("0");
            startProcess();
        }
        
        if (!listModel2.isEmpty()) {
            clearButton.setEnabled(true);
            deleteButton.setEnabled(true);
        }
        
    }//GEN-LAST:event_scanButtonActionPerformed
       
    private void startProcess() {
        for (int x = 0; x < listModel1.getSize(); x++) {
            FindDuplicates.printDuplicates(listModel1.elementAt(x).toString(), listModel2, totalFiles, duplicateFiles);
        }
    }
    
    private void clearButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clearButtonActionPerformed
        
        if (listModel2.isEmpty() == false) {
            System.out.println("size = 0");
            clearButton.setEnabled(false);
            deleteButton.setEnabled(false);
        }
        listModel2.clear();
    }//GEN-LAST:event_clearButtonActionPerformed

    private void exitMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitMenuActionPerformed
        System.exit(0);
    }//GEN-LAST:event_exitMenuActionPerformed

    private void addFolderMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addFolderMenuActionPerformed
        if (jFileChooser1.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
            for (int x = 0; x < jFileChooser1.getSelectedFiles().length; x++) {
                listModel1.addElement(jFileChooser1.getSelectedFiles()[x].toString());
            }
            scanButton.setEnabled(true);
        }
    }//GEN-LAST:event_addFolderMenuActionPerformed

    private void resetMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_resetMenuActionPerformed
        totalFiles.setText("0");
        duplicateFiles.setText("0");
        removeButton.setEnabled(false);
        removeAllButton.setEnabled(false);
        scanButton.setEnabled(false);
        clearButton.setEnabled(false);
        deleteButton.setEnabled(false);
        listModel1.clear();
        listModel2.clear();
    }//GEN-LAST:event_resetMenuActionPerformed

    private void exportButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exportButtonActionPerformed
        final JFileChooser finder = new JFileChooser();
        finder.setFileFilter(new FileNameExtensionFilter("Text File", "txt"));
        int returnVal = finder.showSaveDialog(null);
        if (returnVal == javax.swing.JFileChooser.APPROVE_OPTION) {
            java.io.File file = finder.getSelectedFile();
            String file_name = file.toString() + ".txt";
            JOptionPane.showMessageDialog(null, "Exporting Text File Completed.");
                         
            try {
            	PrintWriter output = new PrintWriter(new FileWriter(file_name ,true));
	            	for (int x = 0; x < listModel2.size(); x++) {
			        	output.println(listModel2.get(x).toString() + "\n");
	            	}
	            	output.close();
            } catch (IOException e) {
                System.out.println(e.getMessage());
            }   
        }
    }//GEN-LAST:event_exportButtonActionPerformed

    private void instuctionsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_instuctionsActionPerformed
        JOptionPane.showMessageDialog(null, "Click Add button to select a directory then click Scan button to start.");
    }//GEN-LAST:event_instuctionsActionPerformed

    private void removeAllButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeAllButtonActionPerformed
        listModel1.removeAllElements();
        listModel2.clear();
        
        removeAllButton.setEnabled(false);
        scanButton.setEnabled(false);
        
        duplicateFiles.setText("0");
        totalFiles.setText("0");

    }//GEN-LAST:event_removeAllButtonActionPerformed

    private void deleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteButtonActionPerformed
        
        int size = listOfDupliacateFiles.getSelectedIndices().length;
        for (int x = 0; x < size; x++) {
            if (listOfDupliacateFiles.getSelectedIndex() != -1) {
                
                int confirm = JOptionPane.showConfirmDialog(null, "Do you want to delete this file?", "Delete", JOptionPane.YES_NO_OPTION);

                if ( confirm == 0 ) {
                    Object selected = listModel2.remove(listOfDupliacateFiles.getSelectedIndex());
                    String path = selected.toString();
                    
                    String fileName = path;
                    System.out.println(path); // path selected
                    File f = new File(fileName);
                    f.delete();
                }

            }
        } // !this will only remove the selection in the list of duplicate files!
        
        
        
    }//GEN-LAST:event_deleteButtonActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {

            @Override
            public void run() {
                new MainFrame().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem aboutMenu;
    private javax.swing.JButton addButton;
    private javax.swing.JMenuItem addFolderMenu;
    private javax.swing.JButton clearButton;
    private javax.swing.JButton deleteButton;
    private javax.swing.JList directoriesToScan;
    private javax.swing.JLabel duplicateFiles;
    private javax.swing.JMenuItem exitMenu;
    private javax.swing.JButton exportButton;
    private javax.swing.JMenu instructions;
    private javax.swing.JMenuItem instuctions;
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JFileChooser jFileChooser1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JList listOfDupliacateFiles;
    private javax.swing.JButton removeAllButton;
    private javax.swing.JButton removeButton;
    private javax.swing.JMenuItem resetMenu;
    private javax.swing.JButton scanButton;
    private javax.swing.JLabel totalFiles;
    // End of variables declaration//GEN-END:variables
}
